package com.ssy.lingxi.component.redis.config;

import com.ssy.lingxi.component.redis.lock.LockTemplate;
import com.ssy.lingxi.component.redis.lock.RedisLockExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * redisLock配置
 * @author yzc
 * @version 2.0.0
 * @date 2021/7/15
 */
@Configuration
public class RedisLockConfig {

    @Bean
    public RedisLockExecutor redisLockExecutor(StringRedisTemplate stringRedisTemplate) {
        return new RedisLockExecutor(stringRedisTemplate);
    }

    @Bean
    public LockTemplate lockTemplate(RedisLockExecutor redisLockExecutor) {
        return new LockTemplate(redisLockExecutor);
    }

}
